#pragma once
#include"Hash.h"

namespace Unordered_set
{
	template<class K,class Hash = HashFunc<K>>
	class unordered_set
	{
		struct Unordered_set_KeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef Hash_Bucket::Hash_Table_Iterator<K, const K, Unordered_set_KeyOfT, Hash> iterator;
		iterator begin()
		{
			return _U_set.begin();
		}

		iterator end()
		{
			return _U_set.end();
		}

		pair<iterator,bool> insert(const K& key)
		{
			return _U_set.Insert(key);
		}

		size_t size()
		{
			return _U_set.Size();
		}

		bool empty()
		{
			return _U_set.Empty();
		}

	private:
		Hash_Bucket::Hash_Table<K, const K, Unordered_set_KeyOfT,Hash> _U_set;
	};

	void test_set1()
	{
		unordered_set<int> us;
		us.insert(3);
		us.insert(1);
		us.insert(5);
		us.insert(15);
		us.insert(45);
		us.insert(7);

		unordered_set<int>::iterator it = us.begin();
		while (it != us.end())
		{
			//*it += 100;
			cout << *it << " ";
			++it;
		}
		cout << endl;

		for (auto e : us)
		{
			cout << e << " ";
		}
		cout << endl;
		cout << us.size() << endl;
	}
}